home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / msdemo.zip / MSDEMO.PAS < prev   
Pascal/Delphi Source File  |  1993-01-04  |  1KB  |  56 lines

  1. program msdemo;
  2.  
  3. uses    crt,mouse;
  4.  
  5. const
  6.      EventMask   = $001F;  (* Specifies events to interrupt on *)
  7.                            (* See your Mouse Reference Manual  *)
  8.      BothButtons = 3;
  9.      LeftButton  = 1;
  10.      RightButton = 2;
  11.  
  12. begin
  13.      ClrScr;
  14.      MouseRegister(EventMask);
  15.  
  16.      if MousePresent <> 0 then
  17.      begin
  18.        GotoXY(20,10);
  19.        WriteLn('Press right and left mouse buttons to exit');
  20.        ShowMouse;
  21.  
  22.        while Buttons <> BothButtons do
  23.        begin
  24.          if EventFlag <> 0 then
  25.          begin
  26.            GotoXY(1,1);
  27.            Write('X = ',Xcoord,
  28.                 ' Y = ',Ycoord,
  29.                 ' Offset screen address = ',MCursorAddr,'  ');
  30.            if Buttons <> 0 then
  31.            begin
  32.              if Buttons = RightButton then
  33.              begin
  34.                GotoXY(1,25);
  35.                Write('Right button pressed')
  36.              end
  37.              else if Buttons = LeftButton then
  38.              begin
  39.                GotoXY(1,25);
  40.                Write('Left button pressed');
  41.              end
  42.            end
  43.            else
  44.            begin
  45.              GotoXY(1,25);
  46.              ClrEOL
  47.            end;
  48.            EventFlag := 0
  49.          end
  50.        end;
  51.        HideMouse;
  52.        MouseUnregister
  53.      end;
  54.      ClrScr;
  55. end.
  56.